@extends('admin.base')


@section('content')
<!-- Content Header (Page header) -->
    <section class="content-header">
          <h1>
            信息输出表
            <small>preview of simple tables</small>
          </h1>
          <ol class="breadcrumb">
            <li><a href="#"><i class="fa fa-dashboard"></i> 首页</a></li>
            <li><a href="#">后台管理员管理</a></li>
            
          </ol>
        </section>
    <div class="search_wrap">
        <form action="{{url('admin/admin_user')}}" method="get">
            <table class="search_tab">
                <tr>

                    <th width="70">关键字:</th>
                    <td><input type="text" name="keywords" placeholder="关键字"
                        {{--value="@if(empty($keys))@else{{$keys}}@endif"--}}
                        value="{{ isset($keys) ? $keys : '' }}"

                        ></td>
                    <td><input type="submit" name="sub" value="查询"></td>
                </tr>
            </table>
        </form>
    </div>
        <!-- Main content -->
        <section class="content">
          <div class="row">
            <div class="col-md-12">
              <div class="box">
                <div class="box-header with-border">
                  <h3 class="box-title"><i class="fa fa-th"></i> 管理员信息管理</h3>
                  &nbsp; <button class="btn btn-sm btn-primary" onclick="window.location='{{URL('admin/admin_user/create')}}'">添加管理员</button>
                </div><!-- /.box-header -->
                <div class="box-body">
                  <table class="table table-bordered">
                    <tr>
                      <th style="width:60px">id号</th>
                      <th>账号</th>
                      <th>电话</th>
                      <th>头像</th>
                      <th>添加时间</th>
                      <th style="width: 170px">操作</th>
                    </tr>
                    @foreach($data as $vo)
                        <tr>
                            <td>{{ $vo->id }}</td>
                            <td>{{ $vo->username }}</td>
                            <td>{{ $vo->phone }}</td>
                            <td><img width="70pxpx" height="70px" src='/{{ $vo->pic }}'/></td>
                            <td>{{ $vo->created_at }}</td>
                            <td>
                              <!--
                              <a href="{{url('admin/admin_user/'.$vo->id.'/destroy')}}"><button class="btn btn-xs btn-danger">删除</button></a>
                                -->
                               <a href="javascript:;" onclick="doDel({{$vo->id}})"><button class="btn btn-xs btn-danger">删除</button></a>
                               <a href="{{url('admin/admin_user/'.$vo->id.'/edit')}}"><button class="btn btn-xs btn-primary" >编辑</button></a>
                               <a href="{{url('admin/auth/'.$vo->id)}}"><button class="btn btn-xs btn-success" >分配角色</button></a></td>
                        </tr>
                    @endforeach
                    
                  </table>
                </div><!-- /.box-body -->
                <div class="box-footer clearfix">
                  <div class="page_list">
                    {{ $data->links() }}
                </div>
                </div>
              </div><!-- /.box -->

            </div><!-- /.col --> 
          </div><!-- /.row -->
        </section><!-- /.content -->
        
    @endsection
    
    
    <script type="text/javascript">
        
		
		function doDel(id){

      

      
      //询问框
      layer.confirm('是否确认删除？', {
          btn: ['确定','取消'] //按钮
      }, function(){
			     $.post("{{url('admin/admin_user')}}/"+id,{'_method':'delete','_token':"{{csrf_token()}}"},function(data){
              if(data.status == 0){
                  location.href = location.href;
                  layer.msg(data.msg, {icon: 6});
              }else{
                  location.href = location.href;
                  layer.msg(data.msg, {icon: 5});
              }
            });

            }, function(){

      });



		}
		

       
    </script>
